<?php
/**
 * common model file Created by PhpStorm.
 * User: yang
 * Date: 2020/04/28
 */

namespace Common\Model;

class AdminRoles extends Base
{
    protected $table = 'admin_roles';
    protected $guarded = [];

    //public $timestamps = false;

    //一对多
    public function get_power()
    {
        return $this->hasMany(RolesPower::class, 'roles_id', 'roles_id')
            ->select('roles_id', 'power_id');
    }

    //一对多关联权限
    public function roles()
    {
        return $this->hasMany(Roles::class, 'id', 'roles_id')
            ->select('id', 'status')->where('status',0);
    }
}